package com.ioday01test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FileInputStreamTest {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("0110.dat");
        int read = fis.read();
        System.out.println(read);
        System.out.println("读取成功");
        fis.close();

        File file = new File("s.txt");
        FileInputStream fis1 = new FileInputStream(file);
        byte[]  data = new byte[(int) file.length()];
        fis1.read(data);
        String s = new String(data, StandardCharsets.UTF_8);
        System.out.println("字符串读取成功");




    }
}
